<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
    .sliderbar {
        position: fixed;
        right: 0;
        bottom: 100px;
        width: 40px;
        height: 40px;
        text-align: center;
        line-height: 40px;
        cursor: pointer;
        color: #fff;
    }
    
    .con {
        position: absolute;
        left: 0;
        top: 0;
        width: 200px;
        height: 40px;
        background-color: purple;
        z-index: -1;
    }
    </style>
    <script src="./animate.js"></script>
</head>
<body>
     <div class="sliderbar">
         <span>⬅</span>
         <div class="con">问题反馈</div>
     </div>
     <script>
        // 先获取元素
        var div=document.querySelector('.sliderbar')
        var con=document.querySelector('.con')
        //鼠标移入事件
        div.addEventListener('mouseenter',function(){
            //调用animate函数
            animate(con,-160,function(){
                div.children[0].innerHTML='→'
            })
        })
        //鼠标移出事件
        div.addEventListener('mouseleave',function(){
            //调用animate函数
            animate(con,-0,function(){
                div.children[0].innerHTML='→'
            })
        })
     </script>
</body>
</html>